﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace ShootThemUp
{
    public enum EnumTypeEnnemi
    {
        Patate, Vaisseau, Haricot, Frite, Boss
    }

    public class TypeEnnemi
    {
        public EnumTypeEnnemi Type { get; set; }
        public Dictionary<TypeBonus, int> ProbablilitesBonus { get; set; }
        public Texture2D Texture;
        public Point Vitesse { get; set; }
        public int NbVies { get; set; }

        public TypeEnnemi(XElement elementConstruction)
        {
            ProbablilitesBonus = new Dictionary<TypeBonus, int>();

            Type = (EnumTypeEnnemi)Enum.Parse(typeof(EnumTypeEnnemi), elementConstruction.Attribute("nom").Value, true);
            int vitesseX = int.Parse(elementConstruction.Attribute("vitesseX").Value);
            int vitesseY = int.Parse(elementConstruction.Attribute("vitesseY").Value);
            Vitesse = new Point(vitesseX, vitesseY);
            NbVies = int.Parse(elementConstruction.Attribute("nbVies").Value);

            foreach (XElement probaBonus in elementConstruction.Descendants("probaBonus"))
            {
                TypeBonus typeBonus = (TypeBonus)Enum.Parse(typeof(TypeBonus), probaBonus.Attribute("nomBonus").Value, true);
                ProbablilitesBonus.Add(typeBonus, int.Parse(probaBonus.Attribute("proba").Value));
            }

             
        }
    }
}
